package com.zycfc.zsf.boot.util.number;

import com.google.common.math.*;
import java.math.*;

public abstract class MathUtils
{
    public static boolean isPowerOfTwo(final int value) {
        return IntMath.isPowerOfTwo(value);
    }
    
    public static boolean isPowerOfTwo(final long value) {
        return LongMath.isPowerOfTwo(value);
    }
    
    public static int modByPowerOfTwo(final int value, final int mod) {
        return value & mod - 1;
    }
    
    public static int gcd(final int a, final int b) {
        return IntMath.gcd(a, b);
    }
    
    public static long gcd(final long a, final long b) {
        return LongMath.gcd(a, b);
    }
    
    public static int mod(final int x, final int m) {
        return IntMath.mod(x, m);
    }
    
    public static long mod(final long x, final long m) {
        return LongMath.mod(x, m);
    }
    
    public static long mod(final long x, final int m) {
        return LongMath.mod(x, m);
    }
    
    public static int divide(final int p, final int q, final RoundingMode mode) {
        return IntMath.divide(p, q, mode);
    }
    
    public static long divide(final long p, final long q, final RoundingMode mode) {
        return LongMath.divide(p, q, mode);
    }
    
    public static int pow(final int b, final int k) {
        return IntMath.pow(b, k);
    }
    
    public static long pow(final long b, final int k) {
        return LongMath.pow(b, k);
    }
    
    public static int sqrt(final int x, final RoundingMode mode) {
        return IntMath.sqrt(x, mode);
    }
    
    public static long sqrt(final long x, final RoundingMode mode) {
        return LongMath.sqrt(x, mode);
    }
}
